/*
 * 
 * author     date                    function                 purpose
 * wuwentao   20111122             base structure            render the main screen's items except wolf,player, ocean ball*/

package com.badlogicgames.framwork;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogicgames.oceanballwar.Assets;

public class WorldRenderer {
	static final float FRUSTUM_WIDTH = 10;
	static final float FRUSTUM_HEIGHT = 15;
//	World world;
	OrthographicCamera cam;
	SpriteBatch batch;
	TextureRegion background;

	public WorldRenderer (SpriteBatch batch) {

		this.cam = new OrthographicCamera(FRUSTUM_WIDTH, FRUSTUM_HEIGHT);
		this.cam.position.set(FRUSTUM_WIDTH / 2, FRUSTUM_HEIGHT / 2, 0);
		this.batch = batch;
	}

	public void render () {

		cam.update();
		batch.setProjectionMatrix(cam.combined);
		renderBackground();
		//renderObjects();
	}

	public void renderBackground () {
		batch.disableBlending();
		batch.begin();
		batch.draw(Assets.backgroundRegion, cam.position.x-FRUSTUM_WIDTH/2, cam.position.y-FRUSTUM_HEIGHT/2, FRUSTUM_WIDTH,
				FRUSTUM_HEIGHT);
		batch.end();
	}

	public void renderObjects () {
		batch.enableBlending();
		batch.begin();
		renderPlayer();
		renderItems();
		batch.end();
	}

	private void renderPlayer () {
		
	}

	private void renderWolves () {
		
	}

	private void renderItems () {
		
	}

}
